package com.example.mapper;

import com.example.pojo.Emp;
import com.example.pojo.Wages;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {
    Long count(String name, int departmentID, LocalDate begin, LocalDate end);

    List<Emp> page(Integer start, Integer pageSize, String name, int departmentID, LocalDate begin, LocalDate end);

    @Insert("insert into employees (name,email,position,departmentID,hireDate) values (#{name},#{email},#{position},#{departmentID},#{hireDate})")
    void add(Emp emp);

    void deletes(List<Integer> ids);

    void update(Emp emp);

    @Select("select * from employees")
    List<Emp> select();
@Delete("delete from employees where departmentID = #{id}")
    void deleteByDept(Integer id);
@Insert("insert into wages (deptid,empid,empname,month,wages,position) values (#{deptid},#{empid},#{empname},#{month},#{wages},#{position})")
    void set_wages(Wages wages);
@Select("select name from employees where departmentID in (21,22,25,26,23)")
    List<Emp> selectss();
}
